package com.wang.springbootinit.utils;

import cn.hutool.core.util.StrUtil;
import com.wang.springbootinit.exception.BusinessException;

public class DigestUtils {
    private static final String SALT = "salt";
    public static String encrypt(String password) {

        if (StrUtil.isEmpty(password)) {
            throw new BusinessException("Password cannot be null or empty");
        }
       return  org.springframework.util.DigestUtils.md5DigestAsHex((SALT + password).getBytes());
    }
}
